import Axios from "@/utils/request.ts";
import {
  UserInfoRes,
  UserRegisterReg,
  UserInfoDetails,
  updateUserInfo,
  userHourDataRes,
  UserLoginReq,
  NewTokenRes,
} from "@/types/user.ts";
export const UserAxios = {
  //平台注册接口
  register(params: UserRegisterReg): Promise<UserInfoRes> {
    return Axios.post("/hall/v1/user/reg", params);
  },
  //平台登录接口   login(params: UserLoginReq): Promise<UserInfoRes> { login(params: { param: string })
  login(params: UserLoginReq): Promise<UserInfoRes> {
    return Axios.post("/hall/v1/user/login", params);
  },
  //用户信息详情
  getUserInfo(): Promise<UserInfoDetails> {
    return Axios.post("/hall/v1/user/getUserInfo");
  },
  // 修改用户个人资料
  updateUserInfo(params: updateUserInfo): Promise<updateUserInfo> {
    return Axios.post("/hall/v1/user/updateUserProfile", params);
  },
  //获取用户投注信息列表
  getUserHourData(parems: { timeType: number }): Promise<userHourDataRes> {
    return Axios.post("/hall/v1/user/getUserHourData", parems);
  },
  //获取新的登录token
  getNewToken(params: { device: string; deviceId: string }): Promise<NewTokenRes> {
    return Axios.post("/hall/v1/user/getNewToken", params);
  },
  //绑定用户token
  bindUserToken(params: {
    os: string;
    type: number;
  }): Promise<{ accessToken: string; expiresIn: number }> {
    return Axios.post("/hall/v1/user/getNewToken", params);
  },
  //验证token免登录的
  checkUserToken(params: {
    os: string;
    type: number;
    token: string;
    deviceId: string;
  }): Promise<UserInfoRes> {
    return Axios.post("/hall/v1/user/checkUserToken", params);
  },
  //获取存储桶临时授权url
  getS3TempToken(params: { dir: string; fix: string }): Promise<{ fileUrl: string; url: string }> {
    return Axios.post("/hall/v1/user/getS3TempToken", params);
  },
};
